<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="/view/conf/farmtag.tld" prefix="PF"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE html>
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>演示-<PF:ParameterValue key="config.sys.title" /></title>
    
	<meta name="description"
	content='<PF:ParameterValue key="config.sys.mate.description"/>'>
	<meta name="keywords"
		content='<PF:ParameterValue key="config.sys.mate.keywords"/>'>
	<meta name="author"
		content='<PF:ParameterValue key="config.sys.mate.author"/>'>
	<meta name="robots" content="index,follow">
	<jsp:include page="../web-simple/atext/include-web.jsp"></jsp:include>
	<script charset="utf-8"
	src="<PF:basePath/>/text/lib/super-validate/validate.js"></script>
	<script charset="utf-8"
		src="<PF:basePath/>/text/lib/kindeditor/kindeditor-all-min.js"></script>
	<link rel="stylesheet"
		href="<PF:basePath/>/text/lib/kindeditor/themes/default/default.css" />
 </head>
  
  <body>
    <jsp:include page="../web-simple/commons/head.jsp"></jsp:include>
    <jsp:include page="../web-simple/commons/superContent.jsp"></jsp:include>
    <div class="containerbox">
		<div class="container">
		  <div class="row clearfix">			  
				<div class="col-sm-12 column well well-lg">	
				
					<form id="filepub"  class="form form-horizontal " role="form" method="post" action="webonline/PubUpload.do" enctype="multipart/form-data">
							<div class="form-group">
							    <label for="lastname" class="col-sm-2 control-label">标题</label>
							    <div class="col-sm-10">
							      <input type="text" class="form-control" id="title" name="title" placeholder="请输入标题">
							    </div>
							 </div>
							  <div class="form-group">
							    <label for="type" class="col-sm-2 control-label">类型</label>
							    <div class="col-sm-10">							     
							     	<select class="easyui-combotree" style=" width: 300px" data-options="required:true,value:'选择类型'" url="webonline/PubgetType.do" name="filetype"></select>						    
							    </div>
							 </div>
							 <div class="form-group">
							    <label for="lastname" class="col-sm-2 control-label">文件</label>
							    <div class="col-sm-10">		
							    	 <button class="btn btn-primary" type="button"><span class="glyphicon glyphicon-folder-open"></span>选择文件</button>					     
							     	 <input name="file" style="width: 144px;
										   					  height: 41px;
										  					  cursor: pointer; font-size: 30px;
										 				      outline: medium none;
										    				  position: absolute;
										 					  filter:alpha(opacity=0);
										  					  -moz-opacity:0;
										  					  opacity:0; 
										  					  left:0px;
										  					  top: 0px;"
										  					  id="file"  
										  					  accept="aplication/zip" type="file" />							    
							    </div>
							    <div class="col-sm-10">							     
							     		 <p class="text-warning" style="background-color:#f2dede;">压缩文件的主目录下必须存在index.html文件！</p>	
							     		 <img class="img-responsive img-rounded" alt="示例图片" src="text/exam.png">				    
							    </div>
							 </div>
							 <div class="form-group">							   
							    <div class="col-sm-12" id="errormessageShowboxId">							     
							     	 
							    </div>
							 </div>
							  <div class="form-group">							    
							    <div class="text-center">
							      	<button class="btn btn-primary" id="upload" type="button">上传</button>
							      	<button class="btn btn-primary" type="reset">重置</button>
							    </div>
							 </div>
							
					</form>													
				</div>					
		</div>
	   </div>				
    </div>
	<jsp:include page="../web-simple/commons/footServer.jsp"></jsp:include>
	<jsp:include page="../web-simple/commons/foot.jsp"></jsp:include>
  </body>
  
  <script type="text/javascript">
 	
/*  function submitForm(){
			$('.easyui-form').form('submit',{
				onSubmit:function(){
					return $(this).form('enableValidation').form('validate');
				}
			});
		}*/
  		$(function() {
			$('#upload').bind('click', function() {
				if (!validate('filepub')) {
					
					$('#errormessageShowboxId').html("<span class='lg-label label-danger text-center'>信息录入有误，请检查！</span>");
				} else {
					$('#filepub').submit();
				}
			});		
			validateInput2('filetype', function(id, val, obj) {
				// 标题
				alert(obj);
				if (valid_isNull(val)) {
					return {
						valid : false,
						msg : '不能为空'
					};
				}				
				return {
					valid : true,
					msg : '正确'
				};
			});	
			validateInput2('title', function(id, val, obj) {
				// 标题
				if (valid_isNull(val)) {				
					return {
						valid : false,
						msg : '不能为空'
					};
				}				
				return {
					valid : true,
					msg : '正确'
				};
			});
			
			validateInput2('file', function(id, val, obj) {
				if ($(obj)[0].files[0].name=='') {
						return {
							valid : false,
							msg : '不能为空'
						};
					}
				return {
					valid : true,
					msg : '正确'
				};			
			});		
		});
		
 		$("#_easyui_textbox_input1").click(function(){alert(1);});	
  

  		$("#file").change(function(){
  		$(this).nextAll().remove();
  		for(var i=0;i<$(this)[0].files.length;i++){ 
  		    var extStart = $(this)[0].files[i].name.lastIndexOf('.');
 			var ext = $(this)[0].files[i].name.substring(extStart+1, $(this)[0].files[i].name.length).toUpperCase();  			  			
  			if(ext!='ZIP')
  			  {
  			  	alert("请上传ZIP压缩文件");			  	
  			  	$(this).parent().parent().next().next().children().children().first().addClass("disabled");	
  			  	$(this).nextAll().remove();
  			  	return{
						valid : false,
						msg : '请上传ZIP压缩文件'
						};	
  			  }			
  			$(this).parent().append('<h5><span class=\'label label-info\'>'+$(this)[0].files[i].name+'</span></h5>');
  		}
  				$(this).parent().parent().next().next().children().children().first().removeClass("disabled");
  		});
  		
  		
  
  /*	 $('#as').diyUpload({
					url:'webonline/PubUpload.do',
					success:function( data ) {
						 alert("上传成功");
					},
					error:function( err ) {
						alert("上传失败!");	
					},
					buttonText : '选择文件',
				    chunked:false,
					// 分片大小
					//chunkSize:512 * 1024,
					//最大上传的文件数量, 总文件大小,单个文件大小(单位字节);
					fileNumLimit:10,
					fileSizeLimit:1500 * 1024 * 1024,
					fileSingleSizeLimit:150 * 1024 * 1024,
					accept: {title:"aplication/zip",
								extensions:"zip,rar",
								mimeTypes:"aplication/*"}
				}); 	*/
  </script>
</html>
			  		